<!doctype html>
<html>

<head>
  <meta charset="UTF-8" />
  <title></title>
  <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->

  <!-- <meta http-equiv="Content-Security-Policy"
    content="default-src 'self' 'unsafe-eval' 'unsafe-inline' data: http: https:;"> -->
  <!-- <meta http-equiv="Content-Security-Policy" content="script-src 'self'; style-src 'self' 'unsafe-inline'; " /> -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <style>
    html,
    body,
    #app {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
    }
  </style>
</head>

<body spellcheck="false">
  <script>
    function getSearchParam() {
      const search = location.search.split('?')[1] || ''
      const reg = /([^?&=]+)=([^?&=]+)/g
      const params = {}
      search.match(reg)?.forEach((item) => {
        const [key, value] = item.split('=')
        params[key] = value
      })
      return params
    }
    function joinSearchParam(params = {}) {
      let search = ''
      Object.keys(params).forEach((key) => {
        search += `${key}=${params[key]}&`
      })
      if (search) search = `?${search}`
      return search
    }
    const search_params = getSearchParam()
    if (search_params.access_token) {
      localStorage.removeItem('access_token')
      localStorage.setItem('access_token', search_params.access_token)
      delete search_params.access_token
      delete search_params.eid
      delete search_params.from_origin
      location.href = location.origin + location.pathname
    }
  </script>
  <div id="app"></div>
  <script type="module" src="/main/main.ts"></script>
</body>

</html>
